#include<iostream>
#include<algorithm>
using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
    int num = 1;
    int  ans = 0;
    while (num <= k / 2&&num<=n) {
        ans += num;
        num++;
    }
   // cout << ans << "ll" <<num<< endl;
    for (int i = k ; i <= (n - num)+k; i++) {
        ans += i;
    }
    cout << ans << endl;
	return 0;
}